Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update proxy features #45979

Merged
merged 41 commits into from
Oct 1, 2024
Merged

Update proxy features #45979

merged 41 commits into from
Oct 1, 2024

Conversation

mcbattirola
Copy link
Contributor

@mcbattirola mcbattirola commented Aug 28, 2024

The proxy service only reads features at startup, leading to potential stale features if they change after the initial load. Some code paths (e.g., SCIM web handlers) check features during requests, which means proxies must be restarted when features change.

This PR introduces a startFeatureWatcher method in the web handler. The watcher periodically pings the auth server (every 5 to 10 minutes) to fetch and update features, ensuring they remain up-to-date without restarting the proxy.

I chose to add the watcher within the handler rather than service.TeleportProcess to minimize the impact on other services. This avoids unintended side effects, as the proxy handler is currently the only component requiring dynamic feature updates. If other services need this in the future, we can consider moving the watcher to a higher-level component. Let me know what you think.

Closes #39161

@mcbattirola mcbattirola force-pushed the mcbattirola/update-proxy-features branch from 7ef795d to b610f4c Compare August 28, 2024 19:34
entitlements/entitlements.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Outdated Show resolved Hide resolved
lib/web/features.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Outdated Show resolved Hide resolved
@mcbattirola mcbattirola force-pushed the mcbattirola/update-proxy-features branch from a5561d3 to 0b30b7b Compare August 29, 2024 12:01
@mcbattirola mcbattirola force-pushed the mcbattirola/update-proxy-features branch from 08a8cf0 to 5c8233e Compare September 2, 2024 13:01
@mcbattirola mcbattirola marked this pull request as ready for review September 2, 2024 13:59
@mcbattirola mcbattirola marked this pull request as draft September 2, 2024 13:59
Copy link

github-actions bot commented Sep 2, 2024

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@mcbattirola mcbattirola added the no-changelog Indicates that a PR does not require a changelog entry label Sep 2, 2024
@mcbattirola mcbattirola marked this pull request as ready for review September 2, 2024 16:05
lib/web/server.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Outdated Show resolved Hide resolved
Comment on lines 26 to 27
// SetClusterFeatures sets the flags for supported and unsupported features
func (h *Handler) SetClusterFeatures(features proto.Features) {
Copy link
Contributor

@rosstimothy rosstimothy Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an unexported function? What external entities should be capable of temporarily overwriting the last stored features?

Suggested change
// SetClusterFeatures sets the flags for supported and unsupported features
func (h *Handler) SetClusterFeatures(features proto.Features) {
// setClusterFeatures sets the flags for supported and unsupported features
func (h *Handler) setClusterFeatures(features proto.Features) {

Copy link
Contributor Author

@mcbattirola mcbattirola Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, but there is a test in e/lib/web/plugindescriptor_okta_test.go: that is using it, and updating this test is not trivial.

I've added a TODO to change this method to unexported, and I'll sync with someone more familiar with those tests to change it.

lib/web/features.go Show resolved Hide resolved
lib/web/features.go Show resolved Hide resolved
lib/web/apiserver_test.go Outdated Show resolved Hide resolved
lib/web/apiserver_test.go Outdated Show resolved Hide resolved
lib/web/apiserver_test.go Outdated Show resolved Hide resolved
@mcbattirola mcbattirola added this pull request to the merge queue Sep 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 30, 2024
@mcbattirola mcbattirola added this pull request to the merge queue Sep 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 30, 2024
@mcbattirola mcbattirola added this pull request to the merge queue Oct 1, 2024
Merged via the queue into master with commit 75bc1f2 Oct 1, 2024
39 checks passed
@mcbattirola mcbattirola deleted the mcbattirola/update-proxy-features branch October 1, 2024 15:18
@public-teleport-github-review-bot

@mcbattirola See the table below for backport results.

Branch Result
branch/v16 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proxy web handler p.h.ClusterFeatures are stale upon cloud feature changes
5 participants